<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width = device-width, initial-scale = 1.0, minimum-scale = 1.0, maximum-scale = 1.0, user-scalable = no"/>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<meta name="keywords" content="" /> 
<meta name="description" content="" />
<title>编辑商品</title>
<link type="text/css" href="../css/reset.css" rel="stylesheet" />
<link type="text/css" href="../css/public.css" rel="stylesheet" />
<link type="text/css" href="../css/style.css" rel="stylesheet" />
<link type="text/css" href="../css/wode.css" rel="stylesheet" />
<script>
    var deviceWidth = Math.min(640, window.innerWidth)
    document.documentElement.style.fontSize = deviceWidth / 7.5 + "px"
</script>
 <script src="../js/jquery.min.js?v=2.1.4"></script>
 <script src="../js/core.js"></script>
 <script src="../js/24.1.0goodsguanlixiajia.js"></script>


</head>

<body>
<!-- top -->
<div class="header">
    <header class="p_header public-red">
        <a href="javascript:history.go(-1);" class="p_header_left">
            <i class="p_left" title="返回"></i>
        </a>
        <h1 class="p_dizhi">编辑商品</h1>
    </header>
</div>
<!--编辑商品-->
<div class="huodong_shangpin J-huodong-shangpin" id="goodsguanli">
</div>


<div class="public-jianxi"></div>
<div class="add_goods_footer">
	<div class="add_goods_con">
		<span>
			<div class="public-xuanze fl public-checkbox" style="margin-top: 6px;">
				
				<label class="goodsCheck">
                	<input type="checkbox" id="AllCheck" />
                </label>
			</div>
			全选
		</span>
		<div class="sell_goods_xia">
			<span>上架</span>
			<em>删除</em>
		</div>
	</div>
</div>
<script type="text/javascript" src="../js/jquery-1.10.1.min.js" ></script>
<script type="text/ecmascript">
	
	//全选
	$("#AllCheck").on('click',function(){
		var $this = $(this);
		
		if($this.prop('checked')){
			$this.closest('label').addClass('on');	
			$('.J-huodong-shangpin').find('.goodsCheck').addClass('on').find('input').prop({"checked":true});
		}else{
			$this.closest('label').removeClass('on');	
			
			$('.J-huodong-shangpin').find('.goodsCheck').removeClass('on').find('input').prop({"checked":false});
		}	
	});
	
	//单个选择
	$('.J-huodong-shangpin').on('click','.goodsCheck',function(){
		var $this = $(this);
		if($this.find('input').prop('checked')){
			$this.addClass('on');		
		}else{
			$this.removeClass('on');
				
		}
		
		//判断是否已经全部选中
		var flags = true;
		$('.J-huodong-shangpin').find('.goodsCheck').each(function(index, element) {
			(function(element){
				if($(element).find('input').prop('checked') == false){
					flags = false;
					return false;	
				}	
			})(element);
		});
		if(flags){
			$("#AllCheck").prop({"checked":true}).closest('label').addClass('on');	
		}else{
			$("#AllCheck").prop({"checked":false}).closest('label').removeClass('on');		
		}	
	})
	

	/**	
	$(".goodsCheck").click(function() {
	    var goods = $(this).parent().parent(".add_goods").find(".goodsCheck"); //获取本店铺的所有商品
	    var goodsC = $(this).parent().parent(".add_goods").find("regular-checkbox:checked"); //获取本店铺所有被选中的商品
	    if (goods.length == goodsC.length) { //如果选中的商品等于所有商品
	
	        $("#AllCheck").attr('checked', true); //全选按钮被选中
	
	    } else { //如果选中的商品不等于所有商品
	      
	      $("#AllCheck").attr('checked', false); //全选按钮也不被选中
	
	    }
	});
	
	// 点击全选按钮
	$("#AllCheck").click(function() {
		
		alert("关闭");
		
	    if ($(this).attr("checked") == true) { //如果全选按钮被选中
	    	
	    	
	    	
	       $(".regular-checkbox").attr('checked', true); //所有按钮都被选中
	       
	    } else {
	    	
	       $(".regular-checkbox").attr('checked', false); //else所有按钮不全选
	       
	    }
	});
	**/
	
	
	
</script>
</body>
</html>